package com.ruoyi.develop.goodsSaleChuan.service.impl;

import java.util.List;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.DateUtils;
        import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.ruoyi.develop.goodsSaleChuan.mapper.GoodsSaleChuanMapper;
import com.ruoyi.develop.goodsSaleChuan.domain.GoodsSaleChuan;
import com.ruoyi.develop.goodsSaleChuan.service.IGoodsSaleChuanService;

/**
 * 串行金具Service业务层处理
 * @author lmm
 * @date 2025-07-05
 */
@Service
public class GoodsSaleChuanServiceImpl implements IGoodsSaleChuanService {
    @Resource
    private GoodsSaleChuanMapper goodsSaleChuanMapper;

    /**
     * 查询串行金具
     * @param id 串行金具主键
     * @return 串行金具
     */
    @Override
    public GoodsSaleChuan selectById(String id) {
        return goodsSaleChuanMapper.selectById(id);
    }

    /**
     * 查询串行金具列表
     * @param entity 串行金具
     * @return 串行金具
     */
    @Override
    public List<GoodsSaleChuan> selectList(GoodsSaleChuan entity) {
        return goodsSaleChuanMapper.selectList(entity);
    }

    @Override
    public List<GoodsSaleChuan> selectListGroupByModels(GoodsSaleChuan entity) {
        return goodsSaleChuanMapper.selectListGroupByModels(entity);
    }
    @Override
    public List<GoodsSaleChuan> selectByModels(GoodsSaleChuan entity) {
        return goodsSaleChuanMapper.selectByModels(entity);
    }
    @Override
    public List<GoodsSaleChuan> selectByGoodsSaleId(GoodsSaleChuan entity) {
        return goodsSaleChuanMapper.selectByGoodsSaleId(entity);
    }
    /**
     * 新增串行金具
     * @param entity 串行金具
     * @return 结果
     */
    @Override
    public int insert(GoodsSaleChuan entity) {
        if(StringUtils.isBlank(entity.getId())){
            entity.setId(IdUtils.fastSimpleUUID());
        }
                entity.setCreateBy(SecurityUtils.getUsername());
                entity.setCreateTime(DateUtils.getNowDate());
            return goodsSaleChuanMapper.insert(entity);
    }

    /**
     * 修改串行金具
     * @param entity 串行金具
     * @return 结果
     */
    @Override
    public int update(GoodsSaleChuan entity) {
                entity.setUpdateBy(SecurityUtils.getUsername());
                entity.setUpdateTime(DateUtils.getNowDate());
        return goodsSaleChuanMapper.update(entity);
    }

    /**
     * 批量删除串行金具
     * @param ids 需要删除的串行金具主键
     * @return 结果
     */
    @Override
    public int deleteByIds(String[] ids) {
        return goodsSaleChuanMapper.deleteByIds(ids);
    }

    /**
     * 删除串行金具信息
     * @param id 串行金具主键
     * @return 结果
     */
    @Override
    public int deleteById(String id) {
        return goodsSaleChuanMapper.deleteById(id);
    }
}
